package tcm.com.gistone.database.mapper;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import tcm.com.gistone.database.entity.Theme;
import tcm.com.gistone.database.entity.User;

import java.util.List;

public interface UserMapper {
    int deleteByPrimaryKey(Long userId);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long userId);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    @Select("select * from tb_user where login_name = #{loginName}")
    @ResultMap("tcm.com.gistone.database.mapper.UserMapper.BaseResultMap")
    User selectOne(String loginName);


    @Select("select * from tb_user where login_name = #{loginName} and user_pwd = #{userPwd}")
    @ResultMap("tcm.com.gistone.database.mapper.UserMapper.BaseResultMap")
    User selectByLoginNameAndUserPwd(@Param ("loginName")String loginName,@Param ("userPwd")String userPwd);

    @Select("select * from tb_user where email = #{email}")
    @ResultMap("tcm.com.gistone.database.mapper.UserMapper.BaseResultMap")
    User selectByEmail(@Param ("email")String email);

    @Select("select * from tb_user where status=#{status} and  token=#{token} and email = #{email}")
    @ResultMap("tcm.com.gistone.database.mapper.UserMapper.BaseResultMap")
    User selectByStatusAndTokenAndEmail(@Param ("status")int status ,@Param ("token") String token, @Param ("email") String email);
}